1638 stories
·
0 followers

Commerce Dept. Chip Inquiry Was Halted After Nvidia Intervention

1 Share
An anonymous reader quotes a report from The New York Times: Investigators at the Commerce Department were deep into a monthslong investigation of a Singaporean company that they suspected of smuggling Nvidia's artificial intelligence chips into China when their work came to a sudden halt late last year. The investigation centered on Megaspeed, a data center company led by an executive who U.S. officials now believe to be a Chinese spy who had a relationship with Nvidia's chief executive, Jensen Huang. But the case was abruptly transferred to the Justice Department last year. The shift came after Commerce Department investigators working on the case received an email from Nvidia's general counsel seeking information about the inquiry into Megaspeed. It is not necessarily unusual for Commerce Department agents working on a case to speak with a company's representatives about issues involving their firm. But what was unusual was the content of the message. Tim Teter, Nvidia's general counsel, said that Jeff Kessler, a top official at the department, had given Nvidia permission to reach out about the case. The agents were alarmed that Nvidia had invoked the name of Mr. Kessler, their superior, who was nominated to his role by President Trump. Some viewed Mr. Kessler's interaction with Nvidia as violating government procedure and potentially tainting the case, according to current and former government officials and others familiar with the incident. It is not clear what led to Mr. Teter's outreach to the department, but the recent revelations about Mr. Huang's acknowledged affair with a Megaspeed executive have only intensified scrutiny of Nvidia's role in influencing policy on chip sales to China. [...] The incident raised questions about what Mr. Kessler, who reports directly to Commerce Secretary Howard Lutnick, had discussed with Nvidia. It also raised the possibility that those discussions could become their own subject of inquiry. Perhaps inadvertently, some officials said, Mr. Kessler had opened himself to accusations of undue influence and potentially jeopardized his department's work on Megaspeed. The case was quickly transferred to the Justice Department in an effort to avoid any potential compromise of the government's investigation of Megaspeed, these people said. The Justice Department is conducting a criminal inquiry into Megaspeed, according to people familiar with the matter.

Read more of this story at Slashdot.

Read the whole story
Share this story
Delete

Claude Code's 'Don't Ask Again' File Exposes Passwords and Keys in 1,122 Public Copies on GitHub

1 Share
Be careful with the file .claude/settings.local.json, warns The Hacker News: Passwords and API keys that developers typed into commands they approved in Claude Code are sitting in public GitHub repositories, where anyone can read them. When a user selects "Yes, and don't ask again," Anthropic's AI coding assistant can save the command, word-for-word, including the secret, in a project settings file. Software security company Apiiro said that 1,122 public copies of that file hold at least one secret, though it did not test whether any still work. One company the researchers notified earlier this week confirmed its key had been live... Removing [the file] from a project does not undo the leak, because older versions stay in git history and in forks of the repository. The researchers' advice is to rotate first: change every password, token, and key the file has ever held, then clean up... Claude Code tries to keep the file out of git. The first time it writes the file in a git repository, it adds the file to the user's global git excludes, its settings documentation says. Git on that computer then ignores the file in every repository. That protection stays in one user's git settings on one computer. It does nothing for a file that was already committed, the researchers say. Claude Code never adds the file to the project's own .gitignore, so the protection does not travel with the project. In 539 of the 1,105 repositories the researchers traced, a commit listing Claude as a co-author changed the file. They take this to mean Claude often commits the file itself. Apiiro's search of public GitHub found 104,185 copies of the file in 103,617 repositories, its research write-up shows. About 1.1% of them, or 1,122 copies, hold at least one secret. Together they hold 1,379 different secrets... ]And "in half of those repositories it had been there for at least 217 days."] More than a third of the secrets open a database directly, including 379 database passwords. Others include 43 SSH logins for public servers, 42 tokens for GitHub, GitLab and npm, and 23 AWS keys. Among the owners of these files are 63 organizations, mostly software companies of all sizes. The strongest cases include a database vendor's own admin-level cloud key and the owner password of a medical-records database, the researchers say. Boris Cherny, Anthropic's head of Claude Code, responded to the story in a comment on Hacker News: "Historically Claude Code has not done secret scrubbing (there are many good tools for that), but we are looking into what we can do to prevent this. That said, a few thoughts: 1. .claude/settings.local.json is meant to stay local. This is not a file you should check into source control. We automatically gitignore it when Claude creates the file, so in this case the files were manually created and checked in (docs: https://code.claude.com/docs/en/settings) 2. Permission rules are old hat. Everyone should be using auto mode instead. It is safer and also does not require manually maintaining finicky allow/deny lists. Auto mode is enabled by default and is included for free in all plans. 3. Regardless of what agent you use, you should have secret scanning enabled. GitHub and other source control hosts offer it. There are many threat models that it protects against and you should absolutely use it if you can. (see https://github.com/security/plans)" Cherny also named approaches Anthropic plans to prototype, Apiiro notes in an update, citing Cherny's goal of "making sure auto mode catches this, building in basic secret scanning," and, when a reader noted the same can happen in auto mode when it asks about a sensitive command, answered "good catch." Claude Code users had already filed a bug report on the issue on August 11, 2025, notes The Hacker News, but "An automated bot closed that report as 'not planned' on January 3, after 60 days without activity." Three more bug reports were then filed, according to the researchers. "None got a reply from Anthropic, and three were closed automatically as inactive or duplicate."

Read more of this story at Slashdot.

Read the whole story
Share this story
Delete

Aaron Swartz Would've Been 40 Today. His 'Legacy Lives On' Says FSF

1 Share
"Aaron Swartz would have turned forty this year," writes FSF deputy director Sean O'Brien. "November 8 is Aaron Swartz Day, when we remember a pioneer of free software and information sharing whose contributions helped shape the modern internet." The Internet Archive will host a hackathon Sunday in San Francisco celebrating Aaron's Swartz's life "and the projects he worked on, many of which are still going strong today," including SecureDrop, OpenLibrary, and Creative Commons. "We are also spreading the word about projects he inspired," including OnionPress and the EFF's Atlas of Surveillancedocumenting police tech use through open source research, now a collaborative effort with volunteers, the University of Nevada, Reno, and the Reynolds School of Journalism. The event is also supported by Free Law Project, and organizers are asking attendees to "bring a color print out of your favorite photos of Aaron for a huge collaborative collage." From the Internet Archive's blog: Aaron was also a co-founder of Creative Commons, where he worked with Lisa Rein developing the RSS-enhanced HTML code that sits behind Creative Commons licenses, much of which is still in use today. The "Quantifying the Commons" project was designed to help measure open-licensed and public-domain works worldwide, and is one of the projects participants can work on. Aaron loved Tor and created tools such as "Tor2web" (with Virgil Griffith) to help more people publish Tor-accessible websites. Onion Press is a Tor-based publishing system designed for decentralized, censorship-resistant publishing, and participants can work on the code base... We also encourage you to have a hackathon in your own town using our materials — or materials of your own. Please let us know if you plan to do this (although it's not required!). If you do let us know, we can include you on our website and help you spread the word about your event. So far, there is an event in Portland sponsored by Portland Civic Lab where they will be screening The Internet's Own Boy and celebrating Aaron's life. "EFF was proud to call Aaron a friend and ally," the digital rights organization posted this week. And the FSF's deputy director writes "It is particularly striking that some of the world's largest companies now rely on technology Swartz helped to develop." One of Swartz's most important technical contributions was his collaboration with John Gruber on Markdown, the simple text formatting system introduced in 2004. Markdown allows users to create structured documents using ordinary text, without requiring proprietary software. More than twenty years later, Markdown has become one of the most popular formats for documentation and publishing, and is widely used in community websites such as forums and wikis. This is not a minor contribution. Companies developing LLMs use Markdown extensively in their products and development tools. OpenAI, for example, recommends Markdown for organizing instructions and communicating structure to its ChatGPT models... Swartz also developed web.py, a public domain framework for building Python applications, and contributed to RSS 1.0, a public internet standard for distributing news and other information between websites. Swartz developed web.py while rewriting the software running Reddit after Reddit acquired Swartz's company Infogami. Reddit recently licensed its content to AI companies, and the FSF's deputy director notes "the enormous scale of the alleged 'piracy' by giant technology corporations" while Aaron himself had "faced criminal prosecution for downloading academic research that he wanted to distribute with no monetary gain." In 2011, federal prosecutors charged Swartz with computer fraud and related offenses after he downloaded millions of academic articles from the JSTOR collection through MIT's university network... Although he was not charged with copyright infringement, he faced aggressive federal prosecution and the possibility of decades in prison before he tragically died by suicide in January 2013, at just twenty-six years old... Swartz helped build tools that made the internet more useful and accessible, and his contributions continue to shape a world he never lived to see. On Aaron Swartz Day, we should remember his achievements and the access-to-knowledge principles that guided them. The companies benefiting from his legacy should respect those same principles by giving users true freedom and control, rather than imposing more restrictions on us all.

Read more of this story at Slashdot.

Read the whole story
Share this story
Delete

Data Centers are Being Powered By Giant Gas Plants, Possibly Increasing Carbon Pollution for Decades

1 Share
Rather than racing toward their net-zero targets, Amazon and other AI/cloud computing companies "are driving emissions sharply higher," reports the Washington Post: To support their data centers, tech firms are driving construction of a new generation of supersized, gas-fired power plants that could lock in hundreds of millions of tons of climate pollution for decades to come, according to corporate disclosures and an analysis conducted for The Post by a researcher at the Harvard T.H. Chan School of Public Health. Industry estimates show these projects have put the tech sector on course to grow from a modest driver of industrial carbon pollution into one of the world's biggest emitters of greenhouse gases. Some anticipate that its share of global carbon emissions will increase as much as fivefold from 2020 to 2030. That would leave the tech industry churning out more than half the climate pollution created by global aviation or shipping — sectors long associated with driving warming... Already, Amazon's carbon footprint reached 80.85 million metric tons last year — 58% larger than when [Amazon CEO Jeff] Bezos pledged to shrink it. The company has veered far from the path laid out in the Paris agreement, which would have emissions falling steeply by now and dropping to 43% below 2019 levels by 2030. The tech companies say in corporate disclosures and public statements that they remain committed to their net zero targets, and they suggest the emissions surge is temporary — to be mitigated down the road, when new energy technologies enable the data centers to run cleaner and more efficiently. They also stress that they continue to invest in clean energy and rank as some of the world's biggest consumers of it. With some complicated accounting maneuvers and carbon credit purchases, their solar, wind and geothermal installations partly cancel out their gas emissions, according to corporate disclosures. A June report from international insurance/asset management Allianz found the world's data center emissions are on track to double to 643 million tons of CO2 annually between 2020 and 2030, the article points out. And they cite American data centers contributing to the problem: Just two gas projects Amazon signed on to for data centers planned in Texas and Pennsylvania "would produce more carbon pollution than the dirtiest facility in the country," an Alabama coal plant powering 1 million homes. Meta is building a nearly six-square-mile campus in Louisiana "that will consume as much electricity as three cities the size of New Orleans." "A sprawling Microsoft project in West Texas involving a giant gas plant built by Chevron and a Google project in Wyoming that would consume five times as much electricity as every household in that state would vastly expand the emissions associated with those companies." "A data center campus in Pike County, Ohio, that will support OpenAI's artificial intelligence operations will consume significantly more gas power, and, therefore, emit more carbon pollution, than the Microsoft and Google projects combined."

Read more of this story at Slashdot.

Read the whole story
Share this story
Delete

Is MAHA dying—or will it be reborn? What's next after crushing midterm losses?

1 Share

As Democrats blew away their Republican rivals in an unprecedented midterm sweep Tuesday, the Make America Health Again movement also got bowled over, raising questions about the fate of the motley movement.

MAHA—which has centered around anti-vaccine activist and current Health Secretary Robert F. Kennedy Jr.—saw many of its favored candidates and allies lose, while vocal adversaries of Kennedy won. And the coalition was splintering under stress even before the voting started; in recent months, supporters have accused Kennedy and the Trump administration of inaction and betrayals in their two years in power.

Now hobbled in Washington, shedding supporters, and showing little to no influence in voting booths, is MAHA on its deathbed? Or will it be reborn—possibly into a new group? Could it be assimilated into a blue platform—after sloughing off the more repulsive, conspiratorial aspects of Kennedy's ideology? These are the questions circling in the aftermath of Tuesday's bloodbath.

In a social media poll Wednesday afternoon, Mary Talley Bowden—a dejected MAHA activist, anti-vaccine advocate, and doctor reprimanded for prescribing ivermectin to treat COVID-19—polled her followers about what should come next. She offered three options: Start a third party, join the Democrats, or overthrow the GOP. As of publication time, joining democrats trailed at just 3 percent of the votes. The remaining votes were roughly split between overthrowing the GOP—whatever that means—and forming a third party, which had a small lead at 49 percent.

Cracking coalition

That MAHA could fade out entirely or fracture into negligible shards seems like a very real possibility. Its collection of disperate groups and varied agenda items has always made its cohesiveness seem tenuous. A Politico poll in June revealed that people who identified as MAHA had different ideas of what the movement's priorities are (or should be), as well as different political leanings, and sometimes opposing ideologies.

Some within the movement embrace (or at least accept) Kennedy's fringe beliefs, such as his zealous anti-vaccine views, his rejection of germ theory, and his false claim that 5G is damaging our brains and causing cancer. Some also believe, like Kennedy, in chemtrails and want all mRNA vaccines banned. There are members who support his plan to ban water fluoridation and also seem fine with his false claim that Lyme disease was created by the US military as a military weapon.

Others, meanwhile, have been attracted to MAHA by the more reasonable, non-absurd issues Kennedy touts. Those include improving the quality of Americans' food and diets, reducing their exposure to environmental contaminants, and limiting the influence of industry and corporate interests on Americans' health, particularly limiting the sway of pharmaceutical and chemical companies.

With the variety of priorities, Kennedy and MAHA leaders have spent the past two years finding a variety of ways to disappoint their members. Some like Bowdon are angered that Kennedy has yet to ban mRNA vaccines. In February, Kennedy sparked particularly intense backlash among supporters for embracing Trump's decision to increase domestic production of the pesticide glyphosate—a pesticide many in the MAHA movement wanted to see banned. Kennedy further fueled feelings of betrayal in September by appearing at a MAHA-branded summit that had hefty corporate sponsorships, including from behemoths such as Walmart, Anthropic, OpenAI, Grail, and UnitedHealth.

"MAHA was supposed to expose the revolving door between money, industry and government, not build its own," Robert Malone, a fringe scientist and previous Kennedy ally, wrote in a scathing response to the summit.

Signs of dying

Going into the midterms on Tuesday, the number of disenchanted MAHA members had mounted. In October, Tiffany Cianci, a former Kennedy supporter, published a MAHA scorecard, which lists 42 promises that Kennedy and leaders made to the MAHA members and then largely broke. The scorecard reports 37 promises broken, five partially fulfilled, and zero kept. One of the "partially kept" promises was removing synthetic dyes from foods, particularly children's foods. Kennedy announced an effort to do that—with much ballyhoo—but later admitted that the FDA did not ban or even have an agreement with food companies to remove the dyes. Instead, Kennedy said he has an "understanding" with food companies. The dyes remain in foods.

In a press release, Cianci wrote that the scorecard revealed "an abysmal string of broken commitments and betrayals." It also contained a direct quote from her, saying: "I believed deeply in the promise that MAHA represented, particularly the possibility of confronting chronic disease and building a healthier future for America’s children. But belief was never supposed to mean blind loyalty."

The press release included quotes from several other prominent MAHA leaders, all expressing disappointment with Kennedy and the Trump administration. Later in October, Calley Means, a top ally and senior advisor to Kennedy, resigned from his position, reportedly "disillusioned" and frustrated by delays in food policy changes sought by MAHA.

Another prominent figure to fall out with Kennedy was Vani Hari, an online influencer who goes by "food babe" and has previously identified as a "MAHA Mom." As voting results were streaming in Tuesday night, Hari posted a comment on social media that she had given Politico months earlier, saying: "Women don’t come out to vote for glyphosate and war," referring to the pesticide Kennedy had embraced and the Iran war.

Midterm devastation

In the wake of the blue sweep, it's clear that more than half of the 24 MAHA-endorsed candidates lost their races Tuesday. That includes Senate candidate Ken Paxton in Texas and Zach Lahn, who ran for Governor of Iowa. Lahn in particular was considered a "dream MAHA candidate," and his campaign was seen as a test of MAHA's political influence. Kennedy himself headlined a political rally for Lahn last week, calling it "the most important election going on in this country." Lahn lost to his Democratic opponent, Rob Sand, who flipped the seat with an 11-point spread, turning the office blue for the first time in 20 years.

Alex Clark Voetberg, who hosts a wellness podcast called Culture Apothecary for Turning Point USA, echoed Hari, pointing to the glyphosate betrayal as a reason for the defeats. "MAHA moms stayed home and it could’ve swayed some of these races that were unbearably close. Should’ve listened to our warnings on protecting glyphosate—but you needed Bayer for the war," Clark Voetberg wrote on social media.

Otherwise, MAHA also lost allies, such as Senator Roger Marshall (R-Kan.), who founded a MAHA caucus in the Senate. Zach Nunn lost his seat in the House despite reports that Kennedy allegedly intervened in the race to help him win. Meanwhile, critics of Kennedy notched wins, including Representative-elect Richard Pan, a physician from California; Senator-elect Annie Andrews, a pediatrician from South Carolina; and Senator-elect Abdul El-Sayed, an epidemiologist with a medical degree from Michigan.

Many congressional Democrats are already raring to hold Kennedy to account and remove him—and several of the newcomers are eager to help make it happen. In August, Andrews laid out her plans for health priorities to South Carolina Democrats, saying, "I believe we need to fully fund the CDC and the NIH, and I believe we need to impeach and remove RFK Jr."

El-Sayed has also sharply rebuked Kennedy and said he looks forward to holding him "accountable for all of the grift." After Kennedy made egregiously bigoted remarks against Arabs and falsely claimed they don't contributed to science and literature, El-Sayed called out Kennedy's lack of qualifications to be US health secretary. "He is an expert in people who have contributed nothing to science," El-Sayed said. (Kennedy has no background in science, medicine, or public health. He also has a loathsome record of making bigoted and racist comments.)

On Wednesday afternoon, Senator Angela Alsobrooks (D-Md.) wrote on social media: "The time is now. RFK Jr. must resign or be fired. End of discussion."

MAHA and Kennedy

If Kennedy is removed from office, the outlook for MAHA in its current form seems even murkier. On the one hand, Kennedy's removal may make it easier for those in the movement to shed the divisive, abhorrent aspects of his ideology and hone attention to the broadly popular issues—healthy foods, environmental contaminants, and industry influence. Such a move may help MAHA cement itself as a sustainable political fixture. But, some of the most vocal figures in the MAHA realm are doggedly loyal to Kennedy, throwing such a transition into doubt.

Zen Honeycutt, an anti-vaccine activist and founder of Moms Across America, is one of those Kennedy loyalists. Honeycutt drew attention before the election for reaching out to Democrats on common causes. Her group endorsed several blue candidates, including Rep. Alexandria Ocasio-Cortez of New York, Sen. Cory Booker of New Jersey, and Rep. Chris Pappas in New Hampshire (all of them won their races).

“We expect Democrats and Republicans to work together," Honeycutt told Politico earlier this month. "Health is not a political issue. You know, poison is not partisan. Cancer is not choosy."

The sensible comment might suggest Honeycutt doesn't care which party or politician follows through with MAHA's goals, just as long as they're achieved. But, this is not actually Honeycutt's position. Her intentions were made clear in exchanges on social media with Bowden, who harshly criticized Honeycutt for crossing party lines, particularly talking with Ocasio-Cortez. "You understand she’s trying to use you?" Bowden wrote.

Honeycutt explained that she was working to smooth Kennedy's path in Washington, not hand power to Democrats, who she said had been "fascist in mandating vaccines." She instead turned the criticism to Bowden, saying the MAHA infighting and mudslinging was what was hurting the cause and handing Democrats wins.

On Wednesday, Honeycutt reaffirmed her allegiance to Kennedy, warning Democrats that impeaching him would be "extremely unwise." She reposted a comment from one of her followers, writing: "I'm willing to give Dems a chance with their new power before I judge. I’m an independent. Kennedy is my red line. If they cross it I want them to get absolutely fucked in 2028."

"Sums it up," Honeycutt wrote.

The blue in MAHA

Still, there are some inklings that part of MAHA could be absorbed into blue platforms—whether the leaders of the movement in its current form like it or not.

Earlier this month, Brinda Adhikari, a journalist and co-host of the podcast Why Should I Trust You?, argued that MAHA wasn't dying but remaking the Democratic Party to be more like its old self. In a Substack post titled, How MAHA Is Making Democrats Democrats Again, Adhikari pointed to a health policy document from House Democrats with a section, led by Ocasio-Cortez, titled, "Reclaiming MAHA and Protecting American Families."

Adhikari wrote that some of the issues touted by MAHA are a natural fit for the Democratic Party. She stretched back to Rachel Carson's seminal Silent Spring in 1962 and the progressive environmental activism that elevated issues of health, pesticides, toxic chemicals, and corporate influence over public health. "These were once bread-and-butter Democratic issues," Adhikari wrote. "But somewhere along the way, Democrats lost some of their identity as the party leading these fights."

Adhikari and Democrats give credit to Kennedy for redirecting attention to these issues, which have broad support among voters.

"Americans’ concerns about chronic disease and food safety, especially that which is linked to corporate influence over environmental regulation and public health, are legitimate and long overdue for a serious legislative response," the House Democrat's policy document reads. "The Make America Healthy Again (MAHA) movement has galvanized a significant segment of the Republican Party and attracted many previously apolitical and non-traditional voters, yet many of the concerns raised by the movement are bipartisan in nature."

A KFF poll in May found that 75 percent of Americans want stricter regulations on food additives—a prominent MAHA priority—and 64 percent want stricter regulation of pesticides in agriculture, another key MAHA agenda item.

But, Kennedy and the Trump administration have not only failed to deliver on these issues, they have spoiled the movement, using "the legitimate concerns of American consumers about food safety to spread misinformation about vaccines, public health, and science," the policy document reads. "Their rhetoric has systematically led to the erosion of trust in public health, the science community, and decreased vaccination rates, leading to fatal outbreaks in some cases."

Possible political shift

Democrats intend to reclaim the popular health and environmental issues, free of Kennedy's corrosive anti-science rhetoric. The document outlines plans to restore regulations that protect clean water and air damaged by the Trump administration, advance policies to keep toxic substances out of food, and further Food is Medicine policies, which provide produce prescriptions to American families to improve nutrition and health.

Adhikari predicts a political shift. "I increasingly think MAHA’s most unexpected legacy may be pushing Democrats back toward their own roots: challenging corporate power, fighting dangerous chemicals in our food supply, and holding toxic polluters accountable," she wrote.

MAHA leaders tied to Kennedy and the anti-vaccine movement, like Bowden and Honeycutt, are unlikely to get behind such a shift. This could cause MAHA's political power—however strong it actually is—to fracture. MAHA leaders have claimed repeatedly that their followers have the ability to sway elections. If MAHA hadn't been betrayed or at least disappointed by Kennedy and Trump in the last two years, MAHA could have prevented Tuesday's Republican wipeout, they have said.

But the polling data doesn't support the idea that keeping MAHA in its current form maximizes its political power. While MAHA does have significant support among voters—41 percent of US adults say they support MAHA—that support is primarily tied to the health, environmental and food safety issues, which are popular among non-MAHA supporters, too. Further, just 4 percent of MAHA supporters cited vaccines and medical choice—Kennedy's key issues—as their reason for supporting the movement, the KFF poll revealed.

Beyond MAHA's primary issues, both voters overall and MAHA supporters specifically said MAHA issues weren't top of mind this election; instead, both groups named the cost of healthcare as a bigger issue than those prioritized by MAHA (the MAHA movement is not associated with the issue of health care reform). A separate KFF poll on election day found that 50 percent of voters thought that the Democratic Party was better able to handle healthcare, while only 30 percent of voters said the same of the Republican Party.

For now, it's unclear exactly how—or if—MAHA will influence the political landscape going forward. It could break apart, live on in revamped Democratic policies, or try forming a new political party entirely. And, apparently, there's also the possibility it will try to overthrow the GOP.

Read full article

Comments



Read the whole story
Share this story
Delete

You shouldn’t change the style of a Win32 static control after it has been created

2 Shares

Win32 classic static controls come with a bunch of possible styles to describe what it renders and how. Maybe it’s text. Maybe it’s an image. Maybe it’s just a solid color.

What happens if you create the control with one style and then change the style later?

Don’t do that.

The Win32 classic static control was originally written in the early 1980s for Windows 1.0, and back then, people didn’t play funny games like changing a static control from text to bitmap. They barely had enough memory to add two numbers together!

The Win32 static control decides what it is when it is created, and it doesn’t listen to the WM_STYLE­CHANGED message to learn that somebody told it to change its clothes. Mostly because the WM_STYLE­CHANGED message wouldn’t exist for another decade. It assumes that the style doesn’t change for the lifetime of the control.

If you change the style on the fly, say, from image to text, what happens is that the control starts up and realizes that it’s an image, so it loads the image. And then when it is destroyed, it checks what it is, and hopefully it still says “You’re an image,” so it frees the image. But if you secretly changed it to “You’re text”, it says “Well, in that case, I don’t have to free an image,” and the image gets leaked.

This behavior has remained unchanged in the static control for backward compatibility. There are almost certainly programs that “know” about this behavior when they change an image static control to a text static control, so they “fix” the problem by deleting the leaked image. If the leak were fixed in the static control, this would result in a double-delete bug.

So just stay away from the electrified wire. If you need to change the style of a static control, destroy it and create a new one with the new style, or create two static controls (say, one image and one text) and hide one and show the other depending on which one you need.

The post You shouldn’t change the style of a Win32 static control after it has been created appeared first on The Old New Thing.

Read the whole story
Share this story
Delete
Next Page of Stories